﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GenUtil.Dto;
using ServiceLayer.Service.Impl;

namespace WebApp
{
    public partial class StudentDefault : System.Web.UI.Page
    {
        protected void Page_PreInit(object sender, EventArgs e)
        {
            string theme = "";
            if (Page.Request.Form.Count > 0)
            {
                //theme = Page.Request["Themes"].ToString();
                if (theme == "Default")
                {
                    theme = "";
                }
            }
            this.Theme = theme;
        }
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            bool result= fetchrollpassword(Login1.UserName, Login1.Password);
            e.Authenticated = result;
        }
        private bool fetchrollpassword(string rollNo, string password)
        {

            StudentDto studentdto = ServiceLocator.getStudentService().getStudentRecord(rollNo);
            if ((studentdto == null) || (studentdto.Password != password))
                return false;
            else
                return true;
        }
    }
}